package cc.orange.adapter;

import android.util.Log;
import android.view.View;
import android.widget.RelativeLayout;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import cc.orange.R;
import cc.orange.entity.MsgInfosVideoEntity;
import cc.orange.utils.CircleImageView;
import cc.orange.utils.emojis.RongUtils;
import demo.smart.access.xutlis.util.ZXScreenUtil;


/**
 * Created by CM on 2022/10/25.
 */

public class MsgaImgAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private int width;
    private int type;
    private ItemClickTalk itemClickTalk;
    public MsgaImgAdapter(@Nullable List<String> data, int type) {
        super(R.layout.item_msga_img, data);
        width = ZXScreenUtil.getScreenWidth() / 3 - 60;
        Log.v("----->width",""+width);
        this.type = type;
    }

    public void setItemClickTalk(ItemClickTalk itemClickTalk){
        this.itemClickTalk = itemClickTalk;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, String item) {
        CircleImageView item_msga_img = helper.getView(R.id.item_msga_img);
        RelativeLayout item_msga_rel = helper.getView(R.id.item_msga_rel);

       RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) item_msga_rel.getLayoutParams();
        layoutParams.width = width;
        layoutParams.height  = width;
        item_msga_rel.setLayoutParams(layoutParams);

        Glide.with(mContext).load(item)
                .into(item_msga_img);
    }


   public interface ItemClickTalk{
        void itemClickTalk(int position);
   }
}
